package com.example.administrator.xxnapp.user;

import com.example.administrator.xxnapp.http.ResultStringCallback;
import com.google.gson.Gson;

import java.io.File;

/**
 * Created by Administrator on 2018/5/25.
 */

public class UserPresenter {
    private IViewUser mIView;
    private IModelUser mIModel;

    public UserPresenter(IViewUser mIView, IModelUser mIModel) {
        this.mIView = mIView;
        this.mIModel = mIModel;
    }

    public void uploadHeadImage(File file,int userId){
        mIModel.uploadHeadImage(file,userId)
                .execute(new ResultStringCallback() {
                    @Override
                    public void onResultSuccess(Gson gson, String dataJsonStr) {
                        mIView.uploadImageSuccess(dataJsonStr);
                    }

                    @Override
                    public void onResultOther(int result, String message) {
                        mIView.uploadImageError(result,message);
                    }
                });
    }
}
